package kr.saeildamil.androidstudy_second.ani;

import kr.saeildamil.andrordstudy.second.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ViewFlipper;

public class ViewFlipperTest extends Activity {
	ViewFlipper mFlip;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch23_viewflippertest);
		
		mFlip = (ViewFlipper) findViewById(R.id.flip);
	}
	
	public void mOnClick(View v){
		CheckBox anim = (CheckBox) findViewById(R.id.chkflip);
		switch(v.getId()){
		case R.id.btnprev:
			mFlip.showPrevious();
			break;
		case R.id.btnnext:
			mFlip.showNext();
			break;
		case R.id.chkflip:
			if (mFlip.isFlipping()){
				mFlip.stopFlipping();
			}else{
				mFlip.startFlipping();
			}
			break;
		case R.id.chkanim:
			if (mFlip.getInAnimation()==null){
				mFlip.setInAnimation(this, R.anim.viewin);
				mFlip.setOutAnimation(this, R.anim.viewout);
			}else{
				mFlip.setInAnimation(null);
				mFlip.setOutAnimation(null);
			}
			break;
		}
	}
}
